//
//  BITabModel.m
//  BIProjectModule
//
//  Created by yown on 2022/2/17.
//

#import "BITabModel.h"
#import "BIProjectContext.h"

#import <BIProjectModule/BIAppDefine.h>

@implementation BITabItemModel

- (UIColor *)itemNormalColor {
    return [UIColor loadColorFromString:@"#BDBDBD"];
}

- (UIColor *)itemSelectedColor {
    return [UIColor loadColorFromString:@"#4CB49E"];
}

@end

@implementation BITabModel

+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper {
    return @{
        @"originalTabArray" : @"apptab",
    };
}

+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass {
    return @{@"originalTabArray" : [BITabItemModel class]};
}

- (NSArray<BITabItemModel *> *)useTabArray {
    if (self.originalTabArray.count > 5) {
        return [self.originalTabArray subarrayWithRange:NSMakeRange(0, 5)];
    } else if (self.originalTabArray.count > 0) {
        return self.originalTabArray;
    } else {
        NSMutableArray *tempArray = [NSMutableArray array];
        BITabItemModel *model1 = [BITabItemModel new];
        model1.itemName = BILocalizedString(@"tab_home");
        model1.itemNormalImage = @"home_unselected";
        model1.itemSelectedImage = @"home_selected";
        model1.itemLink = @"cmd=home";
        [tempArray addObject:model1];
        
        BITabItemModel *model2 = [BITabItemModel new];
        model2.itemName = BILocalizedString(@"tab_atmosphere");
        model2.itemNormalImage = @"atmosphere_unselected";
        model2.itemSelectedImage = @"atmosphere_selected";
        model2.itemLink = @"cmd=atmosphere";
        [tempArray addObject:model2];
        
        BITabItemModel *model3 = [BITabItemModel new];
        model3.itemName = BILocalizedString(@"tab_find");
        model3.itemNormalImage = @"find_unselected";
        model3.itemSelectedImage = @"find_selected";
        model3.itemLink = @"cmd=find";
        [tempArray addObject:model3];
       
        BITabItemModel *model4 = [BITabItemModel new];
        model4.itemCode = @"retailapp-oldwd";
        model4.itemName = BILocalizedString(@"tab_mine");
        model4.itemNormalImage = @"mine_unselected";
        model4.itemSelectedImage = @"mine_selected";
        model4.itemLink = @"cmd=mine";
        [tempArray addObject:model4];
        self.originalTabArray = [tempArray copy];
        return self.originalTabArray;
    }
}

@end
